home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / What's New? / Development Kits / USBDDK_v1.0.1_updated / Examples / USBSampleStorageDriver / BlockDriverPriv.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-29  |  3.0 KB  |  99 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        BlockDriverPriv.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11.  
  12.  
  13. #ifndef __BLOCKDRIVERPRIVH__
  14. #define __BLOCKDRIVERPRIVH__
  15.  
  16. #include <MacTypes.h>
  17. #include <Disks.h>
  18.  
  19. enum {
  20. //    kCDBSize = 12,
  21.     kSenseDataSize = 18
  22. };
  23.  
  24.  
  25. enum {
  26.     kCmdFormat                     = 0x04,
  27.     kCmdInquiry                 = 0x12,
  28.     kCmdModeSelect                 = 0x55,
  29.     kCmdModeSense                 = 0x5A,
  30.     kCmdPreventAllowRemoval     = 0x1E,
  31.     kCmdRead                     = 0x28,
  32.     kCmdReadCapacity             = 0x25,
  33.     kCmdReadFormatCapacities     = 0x23,
  34.     kCmdRequestSense             = 0x03,
  35.     kCmdRezero                     = 0x01,
  36.     kCmdSeek                     = 0x2B,
  37.     kCmdSendDiagnostic             = 0x1D,
  38.     kCmdStartStopUnit             = 0x1B,
  39.     kCmdTestUnitReady             = 0x00,
  40.     kCmdWrite                     = 0x2A,
  41.     kCmdWriteVerify             = 0x2E,
  42.     kCmdVerify                     = 0x2F
  43. };
  44.     
  45. typedef struct ReadCapacityData {
  46.     UInt32        lastLogicalBlock;        // Last valid LBA
  47.     UInt32        blockLength;            // Block length in bytes
  48. } ReadCapacityData, *ReadCapacityDataPtr;
  49.  
  50. // This structure defines each volume (partition) on a physical drive (media)
  51. struct VolumeRec                        // This is needed to support multiple partitions
  52. {
  53.     DrvSts2            driveStatus;        // drive status info & queue element
  54.     UInt16            vRefNum;            // drive number for this volume
  55.     Boolean            mountthispart;        // mount this volume indicator
  56.     Boolean            partmounted;        // volume mounted indicator
  57.     UInt32            partitionNo;        // the partition number for the volume
  58.     UInt32            partoffset;            // phys. offset of data partition
  59.     UInt32            curoffset;            // 0 = physical mapping, else 'partoffset'
  60.     UInt32            partblks;            // number of blocks in the partition
  61.     Ptr                nextVol;            // Link to next volume in the list
  62.     Ptr                drivePtr;            // Pointer to the owning drive's record
  63.     Ptr                mediaIconPtr;        // Pointer to the media icon for this volume
  64. };
  65.  
  66. typedef    struct VolumeRec VolumeRec, *VolumeRecPtr;
  67.  
  68. // Device location icon/string structure format
  69. struct DriverLocationIcon    {
  70.     SInt8    ataLocationIcon[256];        // ICN# data is 256 bytes 
  71.     Str255    ataLocationString;            // returned in C string format
  72. };
  73. typedef struct DriverLocationIcon DriverLocationIcon;
  74.  
  75. // This structure defines each physical drive…
  76. struct DriveRec
  77. {
  78.     UInt32            capacity;            // Drive capacity in blocks
  79.     UInt32            blockSize;
  80.     Boolean            inSleepMode;        // true = drive is in sleep mode (needs reset to access)
  81.     Boolean            doSpindown;            // true = driver manages drive's spindown timer
  82.     Boolean            isSpunDown;            // true = drive is not spinning (low power mode)
  83.     UInt8            busState;            // Drive's bus state (not present, offline, online)
  84.     UInt16            numVolumes;            // Number of partitions in the drive
  85.     VolumeRecPtr    nextVol;            // Pointer to drive's volume list    
  86.     SInt16            modelNo[8];            // First 16 bytes of the model string 
  87.     SInt16            fwRevision[2];        // First 4 bytes of the F/W revision string 
  88. };
  89.  
  90. typedef struct DriveRec DriveRec, *DriveRecPtr;
  91.  
  92. enum {                                    // Values for 'busState'
  93.     kNOT_PRESENT     = 0,                // Drive is off the bus, and not known by system
  94.     kOFFLINE         = 1,                // Drive off the bus, but has volumes mounted
  95.     kONLINE         = 2                    // Drive on bus and the system knows it
  96. };
  97.  
  98. #endif //__BLOCKDRIVERPRIVH__
  99.